home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amoszine 2
/
Amoszine 2.adf
/
MORE_SOURCE_CODE
/
Serial_Slave.AMOS
/
Serial_Slave.amosSourceCode
Wrap
AMOS Source Code
|
1992-02-26
|
934b
|
50 lines
' Serial Master/Slave
' Routine Closes Serial Channel on exiting
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Synchronise computers when linked with null-modem cable
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Steve Pullinger
' ~~~~~~~~~~~~~~~
' MASTER= 0 undefined; 1 This computer has control; 2 This computer is slaved
'
MASTER=0
SEND$="SLAVE"
Serial Open 1,0
While MASTER=0
LISTEN
SEND
Wend
If MASTER=1
Locate 0,0
Print "I have assumed Control"
End If
If MASTER=2
Locate 0,0
Print "Slaved"
End If
Serial Close
Procedure SEND
Shared SEND$
Serial Send 1,SEND$
LOP:
If Serial Check(1)=-1
Wait Vbl
Else
Goto LOP
End If
End Proc
Procedure LISTEN
Shared MASTER,SEND$
A$=Serial Input$(1)
If A$<>""
If A$="SLAVE"
MASTER=2
SEND$="OK"
SEND
End If
If A$="OK"
MASTER=1
End If
End If
End Proc